#include <iostream>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;

//#define READ_FILE

struct Exon
{
	short oriIndex;
	short prev;
	short max;
	unsigned short beg, end;
};
Exon g_exon[1000];

//////////////////////////////////
// quick sort
//////////////////////////////////
int partition(int beg, int end)
{
	int pivotIndex = rand() / RAND_MAX * (end-beg);
	swap(g_exon[beg], g_exon[beg+pivotIndex]);
	
	while (true)
	{
		while (beg < end && g_exon[end].beg >= g_exon[beg].beg) { end--; }
		if (beg == end) { break; }
		
		if (g_exon[beg].beg != g_exon[end].beg) { swap(g_exon[beg], g_exon[end]); }
		beg++;
		
		while (beg < end && g_exon[beg].beg <= g_exon[end].beg) { beg++; }
		if (beg == end) { break; }
		
		if (g_exon[beg].beg != g_exon[end].beg) { swap(g_exon[beg], g_exon[end]); }
		end--;
	}
	return beg;
}

void quickSort(int beg, int end)
{
	if (beg < end)
	{
		int pivot = partition(beg, end);
		quickSort(beg, pivot-1);
		quickSort(pivot+1, end);
	}
}


/////////////////////////////////////
// dynamic programming
/////////////////////////////////////
int calc(int len)
{
	int max = 1;
	int maxIndex = 0;
	for (int i = 1; i < len; ++i)
	{
		for (int j = i-1; j >= 0; --j)
		{
			if (g_exon[i].beg > g_exon[j].end && g_exon[j].max + 1 > g_exon[i].max)
			{
				g_exon[i].max = g_exon[j].max + 1;
				g_exon[i].prev = j;
			}
		}
		
		if (g_exon[i].max > max)
		{
			max = g_exon[i].max;
			maxIndex = i;
		}
	}
	
	return maxIndex;
}

void display(int maxIndex)
{
	vector<short> list;
	int i = maxIndex;
	while (i != -1)
	{
		list.push_back(g_exon[i].oriIndex);
		i = g_exon[i].prev;
	}
	
	for (i = list.size()-1; i >= 0; --i)
	{
		cout << list[i];
		if (i != 0) { cout << ' '; }
	}
	
	cout << endl;
}

int main()
{
#ifdef READ_FILE
	ifstream in("1076.input");
	if (!in) { in.open("../1076.input"); }
#else
	#define in cin
#endif

	srand((unsigned)time(NULL));
	
	int len;
	while ((in >> len) && len)
	{
		for (int i = 0; i < len; ++i)
		{
			in >> g_exon[i].beg >> g_exon[i].end;
			g_exon[i].prev = -1;
			g_exon[i].max = 1;
			g_exon[i].oriIndex = i+1;
		}
		
		quickSort(0, len-1);
		int index = calc(len);
		display(index);
	}
	return 0;
}